#ifndef R2_H
#define R2_H

#include <time.h>
#include "pqueue.h"

#define PCB_STACK_SIZE 1024
#define PCB_NAME_SIZE 32
#define READY 1
#define SUSPENDED 2
#define BLOCKED 3
#define SUSPENDED_BLOCKED 4
#define APPLICATION 2
#define SYSTEM 1

// R1 Merged Defines

#define BUFFER_SIZE 200
#define DEFAULT_DIRECTORY "."
#define DISPLAY_AT_A_TIME 10
#define MAX_ARGS 20
#define NUM_FUNCTIONS 23
#define COMMAND_LENGTH 25

struct process_control_block {	
	char name[PCB_NAME_SIZE];	
	unsigned char stack_base[PCB_STACK_SIZE];
	int memory_size, priority, state, class;
	unsigned char *stack_top, *execute, *load;
	
	clock_t added;
};

typedef struct process_control_block pcb;
typedef struct process_control_block *ppcb;

void pq_init_specialized();
int compare_nodes_priority(void *pcb1, void *pcb2);
int compare_nodes_fifo(void *pcb1, void *pcb2);
int delete_data(void *block);
int find(void *block, int argc, void **argv);
void pq_free_specialized();
void Block_PCB(int argc, char **argv);
void Unblock_PCB(int argc, char **argv);
void Suspend_PCB(int argc, char **argv);
void Resume_PCB(int argc, char **argv);
pcb *Allocate_PCB();
void Create_PCB(int argc, char **argv);
void Delete_PCB(int argc, char **argv);
void Free_PCB(ppcb ptr);
void Insert_PCB(int newState, ppcb pcbToInsert);
void Remove_PCB(ppcb pcbToRemove);
ppcb Setup_PCB(char *, int, int);
ppcb Find_PCB(char *pname);
void Set_Priority(int argc, char **arv); 
void Show_PCB (int argc, char **argv);
void Show_All(int argc, char **argv);
void Show_Ready(int argc, char **argv);
void Show_Blocked(int argc, char **argv);
void Show_Suspended(int argc, char **argv);
void Show_Suspended_Blocked(int argc, char **argv);

int numberp(char *, int);
int get_string_strip_endline(char *, int);
int print_pcb(ppcb);

#endif